﻿
/* =============================================
 Create Info
 Author:      EricHu 
 Create date: 2012-03-11
 Description: 得到用户信息(主要用于显示在用户管理界面中)

 Modify Info
 Modify Date: 
 =============================================*/
CREATE VIEW [dbo].[V_PiUser_GetUserInfo]
AS
SELECT     Id, Code, UserName, RealName, RoleId, UserFrom, WorkCategory, CompanyId, CompanyName, DepartmentId, DepartmentName, WorkgroupId, 
                      WorkgroupName, Gender, Mobile, Telephone, Birthday, Duty, Title, UserPassword, ChangePasswordDate, QICQ, Email, Lang, Theme, AllowStartTime, 
                      AllowEndTime, LockStartDate, LockEndDate, FirstVisit, PreviousVisit, LastVisit, LogOnCount, IsStaff, AuditStatus, IsVisible, UserOnLine, IPAddress, 
                      MACAddress, HomeAddress, OpenId, Question, AnswerQuestion, UserAddress, DeleteMark, Enabled, SortCode, Description, CreateOn, 
                      CreateUserId, CreateBy, ModifiedOn, ModifyUserId, ModifiedBy,
                          (SELECT     Realname
                            FROM          dbo.PiRole AS AliasRole
                            WHERE      (AliasUser.RoleId = Id)) AS RoleName
FROM         dbo.PiUser AS AliasUser
WHERE     (DeleteMark = 0)

